import axios from 'axios'
import API_BASE_URL from '../config'
import { useStore } from 'vuex'
import { objectToFormData } from './tools'

const store = useStore()

export const getAction = (url, params) => {
  let headers = {}
  return axios({
    method: 'GET',
    url: `${API_BASE_URL}${url}`,
    data: params,
    headers: headers
  })
}
export const postAction = (url, params) => {
  let headers = {}
  params = objectToFormData(params)
  return axios({
    method: 'POST',
    url: `${API_BASE_URL}${url}`,
    data: params,
    headers: headers
  })
}
